<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>在线运行PHP代码</title>
<script src="jquery.js"></script>
<script src="pretty.js"></script>
<link rel="stylesheet" type="text/css" href="pretty.css">
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<script type="text/javascript">
	$(function(){
		$('#btnrun').click(function() {
			var content = $('#content').val();
			$.ajax({
				url: 'deal.php',
				type: 'POST',
				dataType: 'html',
				data: {content: content},
				success:function(data){
					$('#show').val(data);
				}
			});
		});
		$('#clear').click(function(){
			$('#content').val('');
			$('#show').val('');
		});
	});
</script>
<style>
	body{background-color: #f5f5f5;}
	.container{margin-top: 30px;}
	.row{padding-bottom: 10px;}
</style>
</head>
<body>
<div class="container">
<div class="row">
	<div class="col-xs-6">
		<span class="text-info">代码</span>
		<button class="btn btn-warning pull-right" type="button" id="clear">清空</button>
	</div>
	<div class="col-xs-6">
		<button class="btn btn-large btn-primary" type="button" id="btnrun">立即运行</button>
		<span class="pull-right text-success">效果</span>
	</div>
</div>
<div class="row">

	<textarea class="col-md-6 prettyprint" id="content" name="content" rows="20">
<?php 
	echo "hello world!";
	$arr=array('a'=>'你好','b'=>'hh好','f'=>'哈哈','y'=>'呵呵');
	print_r($arr);
?>
</textarea>
	<textarea class="col-md-6" id="show" name="show" rows="20" disabled></textarea>
	
</div>
</div>
</body>
</html>